<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>个人信息</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#inputForm").validate({
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
    <style>
        .form-horizontal .control-label{
            float: left;
            font-size: 14px;
        }
        .form-horizontal .controls{
            width:160px;
            margin-left: 10px;
            overflow-x: hidden;
            float: left;
            font-size: 14px;
        }
    </style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/user/info?id=${user.id}">用户详情</a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="user" action="${ctx}/sys/user/info" method="post" class="form-horizontal">
		<sys:message content="${message}"/>
        <div class="control-group">
            <label class="control-label">帐号:</label>
            <div class="controls">
                <label class="lbl">${user.loginName}</label>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">姓名:</label>
            <div class="controls">
                <label class="lbl">${user.name}</label>
            </div>
			<label class="control-label">所属公司:</label>
			<div class="controls">
				<label class="lbl">${user.company.name}</label>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">手机号码:</label>
			<div class="controls">
                <label class="lbl">${user.mobile}</label>
			</div>
            <label class="control-label">区域管理员:</label>
            <div class="controls">
                <label class="lbl">${user.checkBy.name}</label>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">有效期至:</label>
            <div class="controls">
                <fmt:formatDate value="${user.avaliDate}" pattern="yyyy-MM-dd"/>
            </div>
            <label class="control-label">维护人员:</label>
            <div class="controls">
                <label class="lbl">${user.mobile}</label>
            </div>
        </div>
		<div class="control-group">
			<label class="control-label">备注:</label>
			<div class="controls">
                <label class="lbl">${user.remarks}</label>
			</div>
            <label class="control-label">申请人:</label>
            <div class="controls">
                <label class="lbl">${user.createBy.name}</label>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">权限类型:</label>
            <div class="controls">
                <label class="lbl">${user.roleNames}</label>
            </div>
            <label class="control-label">审批人:</label>
            <div class="controls">
                <label class="lbl">${user.checkBy.name}</label>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label">所属分组:</label>
            <div class="controls">
                <label class="lbl">${user.office.name}</label>
            </div>
            <label class="control-label">审批状态:</label>
            <div class="controls">
                <label class="lbl">
                    <c:if test="${user.delFlag==0}">
                        通过
                    </c:if>
                    <c:if test="${user.delFlag==1}">
                        失效
                    </c:if>
                    <c:if test="${user.delFlag==2}">
                        审批中
                    </c:if>
                    <c:if test="${user.delFlag==3}">
                        被驳回
                    </c:if>
                </label>
            </div>
        </div>
		<div class="form-actions">
            <c:if test="${!isSelf}">
                <shiro:hasPermission name="sys:user:edit">
                    <a href="${ctx}/sys/user/form?id=${user.id}" class="btn btn-primary">编   辑</a>
                    <a href="${ctx}/sys/user/delete?id=${user.id}" onclick="return confirmx('确认要删除该用户吗？', this.href)"
                       class="btn btn-danger">删除</a>
                    <a href="${ctx}/sys/user/resetPassword?id=${user.id}" onclick="return confirmx('确认要重置该用户密码吗？', this.href)"
                       class="btn btn-danger">重置密码</a>
                </shiro:hasPermission>
                <br>
                <br>
            </c:if>
            <input class="btn" type="submit" value="查看下属用户"/>
            <input class="btn" type="button" value="查看可控设备列表"/>
            <br>
            <br>
            <c:if test="${user.delFlag != 0}">
                <c:if test="${user.delFlag == 2}">
                    <shiro:hasPermission name="sys:user:check">
                        <a href="${ctx}/sys/user/check?userId=${user.id}&delFlag=0" onclick="return confirmx('确认要通过该用户吗？', this.href)"
                           class="btn btn-success">通 过</a>
                        <a href="${ctx}/sys/user/check?userId=${user.id}&delFlag=3" onclick="return confirmx('确认要驳回该用户吗？', this.href)"
                           class="btn btn-inverse">驳 回</a>
                    </shiro:hasPermission>
                </c:if>
                <c:if test="${user.delFlag==2}">
                    <shiro:lacksPermission name="sys:user:check">
                        <shiro:hasPermission name="sys:user:edit">
                            <a href="${ctx}/sys/user/recheck?userId=${row.id}" onclick="return confirmx('确认要重新提交审核吗？', this.href)"
                               class="btn btn-inverse">重新提交</a>
                        </shiro:hasPermission>
                    </shiro:lacksPermission>
                </c:if>
            </c:if>
        </div>
	</form:form>
</body>
</html>